﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;


using Antlr.Runtime;

namespace testAntlr
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            //ANTLRStringStream str = new ANTLRStringStream("nha van nao viet bo truyen harry potter?");
            //ANTLRStringStream str = new ANTLRStringStream("tac gia jk rowling da viet nhung tac pham nao?");
            //ANTLRStringStream str = new ANTLRStringStream("tac gia jk rowling da viet nhung tac pham nao?");
            //ANTLRStringStream str = new ANTLRStringStream("tac gia jk rowling da viet nhung tac pham nao?");
            ANTLRStringStream str = new ANTLRStringStream("tac pham phat hanh sau nam 2010?");

            testLexer lex = new testLexer(str);

            testParser par = new testParser(new CommonTokenStream(lex));
            String a;
            try{
                a = par.query();
                //a = par.dang1();
                //a = par.dang2();
                //a = par.dang4();
            } catch (Exception d){
                a = null;
            }

            MessageBox.Show(a);
            //MessageBox.Show(par.query());
            //MessageBox.Show(par.query());
            this.Close();
        }
    }
}
